table.insert(itemActions,
	function(item, action)
		-- RARE amulets
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 7
		local identify = true
		local dump = true

		if not (item.quality==ItemQuality.Rare and item.baseItem.code=="amu") then 
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodRareAmulet(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodRareAmulet(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodRareAmulet(item) then
			return dump
		end
		return false
	end
)

function isGoodRareAmulet(item)
	-- still needs work/testing
	local points = 0
	local fcr, sk, sktab = 0, 0, 0
	local stat, hp, mp, ll, ml = 0, 0, 0, 0, 0
	
	if hasRes(item, 16, 4) then
		points = 7
	elseif points == 0 and hasRes(item, 10, 4) then
		points = 5
	elseif points == 0 and hasRes(item, 14, 3) then
		points = 4
	elseif points == 0 and hasRes(item, 20, 2) then
		points = 4
	elseif points == 0 and hasRes(item, 26, 1) then
		points = 4
	end
	
	for i = 0, item.mods:size() - 1 do
		if item.mods[i].Stat.Type == StatType.FasterCastRate then
			fcr = 5
		elseif item.mods[i].Stat.Type == StatType.ClassSkillsBonus and
				item.mods[i].Value >= 2 then -- 2sk
			sk = 6
		elseif  item.mods[i].Stat.Type == StatType.SkillTabBonus and
				item.mods[i].Value >= 2 then --  2sktab
			sktab = 5
		elseif (item.mods[i].Stat.Type == StatType.Strength or
				item.mods[i].Stat.Type == StatType.Dexterity or
				item.mods[i].Stat.Type == StatType.Energy) and
				item.mods[i].Value >=15 then -- 15+str/dex/eng
			stat = 3

		elseif item.mods[i].Stat.Type == StatType.MaxLife then
				if item.mods[i].Value >=40 then -- 41-60 Life
					hp = 4
				elseif item.mods[i].Value >=30 then -- 30-40 Life
					hp = 2
				end
		elseif item.mods[i].Stat.Type == StatType.MaxMana then
				if item.mods[i].Value >=50 then -- 61-90 Mana
					mp = 4
				elseif item.mods[i].Value >=30 then -- 40-60 Mana
					mp = 2
				end
		elseif item.mods[i].Stat.Type == StatType.LifeDrainMinDamage then
				if item.mods[i].Value >=7 then -- 7-9%LL Life
					ll = 2
				elseif item.mods[i].Value >=5 then -- 5-6% LL
					ll = 1
				end
		elseif item.mods[i].Stat.Type == StatType.ManaDrainMinDamage then
				if item.mods[i].Value >=7 then -- 7-9%LL Life
					ml = 2
				elseif item.mods[i].Value >=5 then -- 5-6% LL
					ml = 1
				end
		end
	end

	if (ll + ml) == 2 then 	   -- 5-6% Dual leech, or One 7-9% leech
		points = points + 3
	elseif (ll + ml) == 3 then -- 5-6% and 7-9% Dual leech
		points = points + 4
	elseif (ll + ml) == 4 then -- 7-9% Dual leech
		points = points + 5
	else                       -- One 5-6% leech or No leech.
		points = points + 0.5*(ll + ml)
	end
--	points = points + 4*(fcr + sk + sktab) + 3*(stat + hp + mp)

					  --5    6     3      3     2-3  2-3
	points = points + (fcr + sk + sktab + stat + hp + mp)

-- 7-9DL + 2 Skill = 13
-- 5-6DL + 2 Skill = 8
	return (points >= 5)
end


	--[[
	points
	30+sres: 1
	25+dres: 2
	20+tres: 4
	15+ares: 4

	fcr: 4
	sk/sktab: 4
	15+stat: 3
	41+hp: 3
	61+mp: 2
	5-6ll: 1
	7-9ll: 2
	5-6ml: 1
	7-9ml: 2
	]]--



--[[
	high end mods
	prefix
	mp 61-90
	singleres 31-40
	allres 16-20
	sk 2
	sktab 2
	
	suffix
	str 21-30
	dex 16-20
	eng 16-20
	hp 41-60
	ll 6-9
	ml 6-9
	fcr 10
]]--